<!--[if ie 6]>
      <style type="text/css">
      div#content div.buttonMinibox{width:200px;display:inline;float:none;overflow: hidden;}
      div#content div.buttonBox{width:600px;height:30px;}
      </style>
<![endif]-->

<?php
	echo $accessibility->whereIAm($pageTitle,array(array('title'=>'Funcionários','link'=>'/employees'),array('title'=>'Visualizar funcionário')));
	echo $this->renderElement('message');
	echo "<h2 id='contentTitle'>".$pageTitle."</h2>";
	echo "<div id='view'>";

	if (!empty($employee['User']['photo'])) {
		echo $html->image('../users/photo/'.$employee['User']['id'],array('class'=>'userPhoto'));
	}

	echo "<p><label>Nome: </label><span>".$employee['User']['name']."</span></p>";
	echo "<p><label>Endereço: </label><span>".$employee['User']['address']."</span></p>";
	if (isset($employee['User']['Cidade']['nome'])) {
		echo "<p><label>Cidade: </label><span>".$employee['User']['Cidade']['nome']."</span></p>";
	}else{
		echo "<p><label>Cidade: </label><span></span></p>";
	}
	if (isset($employee['User']['Cidade']['nome'])) {
		echo "<p><label>Estado: </label><span>".$employee['User']['Cidade']['Estado']['nome']."</span></p>";
	}else{
		echo "<p><label>Estado: </label><span></span></p>";
	}
	echo "<p><label>Unidade: </label><span>";
	foreach ($employee['User']['Unit'] as $unit) {
		echo $html->link($unit['nome'],'/units/view/'.$unit['id'])."<br>";
	}
	echo "</span></p>";

	echo "<p><label>Nascimento: </label><span>".date('d/m/Y', strtotime($employee['User']['birthdate']))."</span></p>";
	echo "<p><label>e-mail: </label><span>".$employee['User']['email']."</span></p>";
	//echo "<p><label>Salário: </label><span>".$employee['Employee']['salario']."</span></p>";

	echo "<p><label>Nome de usuário:</label><span>".$employee['User']['username']."</span></p>";
	echo "<p><label>Permissão:</label><span>".$employee['User']['Group']['name']."</span></p>";
	echo "<br />";


	/* Botoes - Inicio */
	$entity = 'employees';
	$model = 'Employee';
	$label = 'funcionário';
	$label_plural = 'funcionários';

	echo "<div class='buttonBox'>";
	echo "<div class='buttonMinibox'>";
	$listButton = "<span class=\"buttonList\">Listar ".$label_plural."</span>";
	echo html_entity_decode($html->link($listButton, '/'.$entity.'/',array('class'=>'button')));
	echo "</div>";
	echo "<div class='buttonMinibox'>";
	if ($othAuth->hasPermission($entity.'/edit/')) {
		$editButton = "<span class=\"buttonEdit\">Editar ".$label."</span>";
		echo html_entity_decode($html->link($editButton, '/'.$entity.'/edit/'.$employee[$model]['id'],array('class'=>'button')));
	}
	echo "</div>";
	echo "<div class='buttonMinibox'>";
	if ($othAuth->hasPermission($entity.'/delete/')) {
		$deleteButton = "<span class=\"buttonDelete\">Apagar ".$label."</span>";
		echo html_entity_decode($html->link($deleteButton,'/'.$entity.'/delete/'.$employee[$model]['id'], array('class'=>'button'), 'Confirma a exclusão deste item?'));
	}
	echo "</div>";

	echo "</div>";

	echo "<div class='buttonBox'>";
	echo "<div class='buttonMinibox'>";
	if ($othAuth->hasPermission($entity.'/send/')) {
		$sendButton = "<span class=\"buttonSendMail\">Enviar mensagem</span>";
		echo html_entity_decode($html->link($sendButton,'/messages/send/'.$employee['User']['id'], array('class'=>'button')));
	}
	echo "</div>";
	echo "</div>";
	/* Botoes - Fim */

	echo "</div>";